package com.api.oa.mapper;

import com.api.oa.model.entity.YQWork;
import com.api.oa.model.vo.OaNoticeVo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface YQWorkMapper {

    @Insert("insert into  yq_work  (" +
            "taskId," +
            "fileType," +
            "url," +
            "createdAt" +
            ") " +
            "values " +
            "(" +
            "#{entity.taskId}," +
            "#{entity.fileType}," +
            "#{entity.url}," +
            "#{entity.createdAt}" +
            ")")
    @Options(useGeneratedKeys = true, keyProperty = "workId", keyColumn = "id")
    Integer insert(@Param("entity") YQWork entity);


    @Update("update  yq_work  set " +
            "workId = #{entity.workId}," +
            "taskId = #{entity.taskId}," +
            "fileType = #{entity.fileType}," +
            "url = #{entity.url}," +
            "createdAt = #{entity.createdAt}," +
            " where workId = #{entity.workId}")
    Integer update(@Param("entity") YQWork entity);


    @Delete("delete from yq_work where workId=#{id}")
    void delete(@Param("id") Long id);


    @Select("select * from  yq_work  where taskId = #{id}")
    List<YQWork> list(@Param("id") Long pid);


    @Select("select * from  yq_work  where workId = #{id} limit 1")
    YQWork findOne(@Param("id") Long id);

}

